'use strict'

const fs = require("fs");

// 写入一个流,存入数据，设置字符集， 注意： 执行路径是项目根目录
var ws1 = fs.createWriteStream("./file-test/hello-output.txt", "utf-8");
ws1.write("myname is huyouming\n");
ws1.write('that`s all');
ws1.end()

var ws2 = fs.createWriteStream("./file-test/hello-ouptut2.txt");
ws2.write(new Buffer("使用Stream写入二进制数据", "utf-8"));
ws2.write(new Buffer("你好世界", "utf-8"));
ws2.end();